﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace PubSubGeneric
{
    public delegate void SubscriptionAddedHandler(object sender, SubscriptionEventArgs e);
    public delegate void SubscriptionRemovedHandler(object sender, SubscriptionEventArgs e);

    public interface ISubscriptionCatalog : IDisposable
    {
        bool Add(string topic,ISubscriptionInfo subscription);
        bool Remove(string topic, ISubscriptionInfo subscription);
        bool Exists(string topic, ISubscriptionInfo subscription);
        bool ClearCatalog();
        bool ClearTopicSubscribers(string topic);
        bool ClearTopicSubscribers<T>(string topic);

        IEnumerable<ISubscriptionInfo> GetTopicSubscribers(string topic);
        IEnumerable<ISubscriptionInfo<T>> GetTopicSubscribers<T>(string topic);
        IEnumerable<ISubscriptionInfo<T>> GetTopicSubscribers<T>(string topic, T arg);

        event SubscriptionAddedHandler OnSubscriptionAdded;
        event SubscriptionRemovedHandler OnSubscriptionRemoved;
    }
}
